package com.gem.mapper;

import com.gem.domain.CampusConn;
import com.gem.domain.CampusVisit;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author: 玲
 * @Description: 我的院校联系人接口
 * @create 2019-10-16 14:48
 * @Modified By:
 */

@Mapper
public interface CampusConnMapper {

    //保存联系人
    Integer save(CampusConn campusConn);

    //查询所有联系人
    @Select("select * from campusConn where campusConn_status > 0")
    List<CampusConn> findAllConn();

    //查询渠道专员的所有联系人
    @Select("select c.*,u.personname from campusConn c, user u where c.campus_id =#{campusId} and c.market_employee_id = u.uid and campusConn_status > 0")
    List<CampusConn> findAll(Integer campusId);

    //根据id查询联系人
    @Select("select c.*,u.personname from campusConn c, user u where c.market_employee_id = u.uid and campusConn_id = #{campusConnId} and campusConn_status > 0\n")
    CampusConn findById(Integer campusConnId);

    //根据id伪删除联系人
    @Update("update campusConn set campusConn_status = -1 where campusConn_id = #{campusConnId}")
    Integer  deleteById(Integer campusConnId);

    //更新联系人信息
    Integer update(CampusConn campusConn);

    //根据id查院校名称
    @Select("select campus_name from campus where campus_id = #{campusId} and campus_status > 0")
    String findCampusName(Integer campusId);

    //伪删除所选联系人
    Integer deleteAll(int[] campusConnIds);


}
